﻿@using JULONG.WEB.Library
@using YHWE.Web.Models;
@model IEnumerable<YHWE.Web.Models.channel>
@{
    string controller = Html.getRoute(routeKeyEnum.controller);
    string oid = Html.getRoute(routeKeyEnum.id);
    Layout = null;
 }
@*
<div class="item">@Html.ActionLink("产品管理", "Index", "product", null, new { controller = "product" })</div>
<div class="item">@Html.ActionLink("产品类型管理", "Index", "productType", null, new { controller = "productType" })</div>*@

@*<div class="item">@Html.ActionLink("动态信息类型", "Index", "documentType", null, new { controller = "documentType" })</div>*@
<hr />  
<div class="item">@Html.ActionLink("客户留言管理", "Index", "guestBook", null, new { controller = "guestBook" })</div>
<hr />
<div class="item">@Html.ActionLink("用户管理", "Index", "user", null, new { controller = "user" })</div>

@foreach (var item in Model) {
    <hr />
    switch((ChannelTypeEnum)Enum.Parse(typeof(ChannelTypeEnum),item.type,true)){
        case ChannelTypeEnum.列表:
            <div class="caption"><strong>@Html.ActionLink(item.name, "Index/" + item.ID, "document", new { @name = item.name }, null)</strong></div>
            break;
        case ChannelTypeEnum.文档:
            <div class="caption"><strong>@Html.ActionLink(@item.name, "Edit/"+item.ID, "siteLibrary",new { @name = item.name }, null)</strong></div>
                                    break;
        case ChannelTypeEnum.外部:
            <div class="caption"><strong>@Html.ActionLink(@item.name, "Edit" + item.ID, "siteLibrary",new { @name = item.name }, null)</strong></div>
                                    break;
        case ChannelTypeEnum.无:
            <div class="caption"><strong>@item.name</strong></div>
            break;
            
    }

    foreach (var subItem in item.channel_sub)
    {

        switch ((ChannelTypeEnum)Enum.Parse(typeof(ChannelTypeEnum), subItem.type, true))
        {
            case ChannelTypeEnum.列表:
                <div class="caption"><strong>@Html.ActionLink(subItem.name, "Index/" + subItem.ID, "document", new { @name = subItem.name }, null)</strong></div>
                                        break;
            case ChannelTypeEnum.文档:
            <div class="caption"><strong>@Html.ActionLink(subItem.name, "Edit/" + subItem.ID, "siteLibrary", new { @name = subItem.name }, null)</strong></div>
                                        break;
            case ChannelTypeEnum.外部:
            <div class="caption"><strong>@Html.ActionLink(subItem.name, "Edit" + subItem.ID, "siteLibrary", new { @name = subItem.name }, null)</strong></div>
                                        break;
            case ChannelTypeEnum.无:
                <div class="caption"><strong>@subItem.name</strong></div>
                                        break;

        }
    }
}
@*<div class="item">@Html.ActionLink("管理日志", "Index", "Log", null, new { controller = "Log" })</div>
<div class="item">@Html.ActionLink("用户登录日志", "Index", "loginLog", null, new { controller = "loginLog" })</div>*@

@*<div class="item"><a target="_blank" href="\">打开网站</a></div>*@
<div class="item">@Html.ActionLink("退出", "unlogin", "Home", null, new { controller = "user" })</div>
<script type="text/javascript">
    $(function () {
        var controller = "@controller";
        var oid = "@oid";
        var urlsObj = $(".menuPanle .item a").each(function () {

            if ($(this).attr("controller") == "document" && controller == "document") {

                if (oid == $(this).attr("oid")) {
                    $(this.parentNode).addClass("focus");
                } else if ($(this).attr("oid")==undefined) {
                    $(this.parentNode).addClass("focus");
                }
            } else {

                if ($(this).attr("controller") == controller) {

                    $(this.parentNode).addClass("focus");

                }
            }

        })

    });
</script>